﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using VipCo.Entities;
using VipCo.Data;

public partial class Controls_DiaDiemMoiControl : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            HienThiNoiDung();
            HienThiLoaiDiaDiem();
        }
    }

    private void HienThiNoiDung()
    {
        int TotalRows = 0;
        TList<DiaDiem> TList_DiaDiem = DataRepository.DiaDiemProvider.GetPaged("TrangThai = 1", "NgayCapNhat DESC", 0, 1, out TotalRows);
        dlDiaDiem.DataSource = TList_DiaDiem;
        dlDiaDiem.DataBind();
    }

    /// <summary>
    /// Hiển thị Loại tin
    /// </summary>
    private void HienThiLoaiDiaDiem()
    {
        int TotalRows = 0;
        TList<DiaDiem> TList_TinTuc = DataRepository.DiaDiemProvider.GetPaged("TrangThai = 1", "NgayCapNhat DESC", 0, 20, out TotalRows);
        dlLoaiDiaDiem.DataSource = TList_TinTuc;
        dlLoaiDiaDiem.DataBind();
    }

    public string GetNoiDung(object Char)
    {
        string s = Char.ToString();
        return Server.HtmlDecode(s);
    }

    public string GetThoiGian(object Char1, object Char2)
    {
        DateTime dt = Convert.ToDateTime(Char1.ToString());
        DateTime dt1 = Convert.ToDateTime(Char2.ToString());
        TimeSpan dt2 = dt1-dt;
        return dt2.ToString();
    }

    public string GetTieuDe(object Char)
    {
        string s = Char.ToString();
        return Common.ConvertToUnSign(s);
    }
}